<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text" name="" id="email">
    <script>
        var y = document.getElementById("email");

        var reg = /^.+@[a-zA-Z\d]+\.[a-zA-Z]+$/;
        y.addEventListener('change', function() {
            reg.test(y.value);
        });
        console.log(y);
    </script>
</body>

</html>